widget: Remove _get_own_allocation
authorTimm Bäder <mail@baedert.org>
Sat, 7 Apr 2018 11:37:24 +0000 (13:37 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 10 Apr 2018 07:43:47 +0000 (09:43 +0200)
Replace all usages of it with _compute_bounds

15 files changed:
gtk/gtkcontainer.c
gtk/gtkentry.c
gtk/gtklistbox.c
gtk/gtkmenu.c
gtk/gtknotebook.c
gtk/gtkpaned.c
gtk/gtkrange.c
gtk/gtkscale.c
gtk/gtkscrolledwindow.c
gtk/gtkseparator.c
gtk/gtkstackswitcher.c
gtk/gtkswitch.c
gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c
gtk/gtkwidgetprivate.h

index 821d02768269377d10c50529a1b1d8b5d71217a3..9ac9cf03b403436cc8091cd69bae33ddbe316eb5 100644 (file)
@@ -1892,7 +1892,6 @@ gtk_container_real_set_focus_child (GtkContainer *container,
     {
       GtkAdjustment *hadj;
       GtkAdjustment *vadj;
-      GtkAllocation allocation;
       gint x, y;
 
       hadj = g_object_get_qdata (G_OBJECT (container), hadjustment_key_id);
@@ -1900,6 +1899,7 @@ gtk_container_real_set_focus_child (GtkContainer *container,
       if (hadj || vadj)
         {
           GtkWidget *child = focus_child;
+          graphene_rect_t child_bounds;
 
           while (gtk_widget_get_focus_child (child))
             child = gtk_widget_get_focus_child (child);
@@ -1908,13 +1908,13 @@ gtk_container_real_set_focus_child (GtkContainer *container,
                                                  0, 0, &x, &y))
             return;
 
-          gtk_widget_get_outer_allocation (child, &allocation);
+          gtk_widget_compute_bounds (child, child, &child_bounds);
 
           if (vadj)
-            gtk_adjustment_clamp_page (vadj, y, y + allocation.height);
+            gtk_adjustment_clamp_page (vadj, y, y + child_bounds.size.height);
 
           if (hadj)
-            gtk_adjustment_clamp_page (hadj, x, x + allocation.width);
+            gtk_adjustment_clamp_page (hadj, x, x + child_bounds.size.width);
         }
     }
 }
index d0050118930858528709f30f9f162d52a28b040b..c6d2bef241f513bf27f48162881c9a89c2bb2b5d 100644 (file)
@@ -3518,12 +3518,12 @@ gtk_entry_event (GtkWidget *widget,
 
   for (i = 0; i < MAX_ICONS; i++)
     {
-      GtkAllocation icon_alloc;
       if (priv->icons[i])
         {
-          gtk_widget_get_outer_allocation (priv->icons[i]->widget, &icon_alloc);
-
-          if (gdk_rectangle_contains_point (&icon_alloc, (int)x, (int)y))
+          int icon_x, icon_y;
+          gtk_widget_translate_coordinates (widget, priv->icons[i]->widget,
+                                            x, y, &icon_x, &icon_y);
+          if (gtk_widget_contains (priv->icons[i]->widget, icon_x, icon_y))
             {
               icon_info = priv->icons[i];
               break;
@@ -7739,8 +7739,8 @@ gtk_entry_get_icon_storage_type (GtkEntry             *entry,
 /**
  * gtk_entry_get_icon_at_pos:
  * @entry: a #GtkEntry
- * @x: the x coordinate of the position to find
- * @y: the y coordinate of the position to find
+ * @x: the x coordinate of the position to find, relative to @entry
+ * @y: the y coordinate of the position to find, relative to @entry
  *
  * Finds the icon at the given position and return its index. The
  * position’s coordinates are relative to the @entry’s top left corner.
@@ -7763,13 +7763,15 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
   for (i = 0; i < MAX_ICONS; i++)
     {
       EntryIconInfo *icon_info = priv->icons[i];
-      GtkAllocation allocation;
+      int icon_x, icon_y;
 
       if (icon_info == NULL)
         continue;
 
-      gtk_widget_get_outer_allocation (icon_info->widget, &allocation);
-      if (gdk_rectangle_contains_point (&allocation, x, y))
+      gtk_widget_translate_coordinates (GTK_WIDGET (entry), icon_info->widget,
+                                        x, y, &icon_x, &icon_y);
+
+      if (gtk_widget_contains (icon_info->widget, icon_x, icon_y))
         return i;
     }
 
@@ -7868,8 +7870,6 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
  * If the entry is not realized or has no icon at the given position,
  * @icon_area is filled with zeros. Otherwise, @icon_area will be filled
  * with the icon's allocation, relative to @entry's allocation.
- *
- * See also gtk_entry_get_text_area()
  */
 void
 gtk_entry_get_icon_area (GtkEntry             *entry,
@@ -7886,7 +7886,16 @@ gtk_entry_get_icon_area (GtkEntry             *entry,
 
   if (icon_info)
     {
-      gtk_widget_get_outer_allocation (icon_info->widget, icon_area);
+      graphene_rect_t r;
+
+      gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r);
+
+      *icon_area = (GdkRectangle){
+        floorf (r.origin.x),
+        floorf (r.origin.y),
+        ceilf (r.size.width),
+        ceilf (r.size.height),
+      };
     }
   else
     {
index 5d7b62b7ed870740040fa88490445f1b8832d4cf..311661b8e2d3d1eb1ac8e7b97585e231077edcd5 100644 (file)
@@ -1437,22 +1437,22 @@ ensure_row_visible (GtkListBox    *box,
   GtkListBoxPrivate *priv = BOX_PRIV (box);
   GtkWidget *header;
   gint y, height;
-  GtkAllocation allocation;
+  graphene_rect_t rect;
 
   if (!priv->adjustment)
     return;
 
-  gtk_widget_get_outer_allocation (GTK_WIDGET (row), &allocation);
-  y = allocation.y;
-  height = allocation.height;
+  gtk_widget_compute_bounds (GTK_WIDGET (row), GTK_WIDGET (box), &rect);
+  y = rect.origin.y;
+  height = rect.size.height;
 
   /* If the row has a header, we want to ensure that it is visible as well. */
   header = ROW_PRIV (row)->header;
   if (GTK_IS_WIDGET (header) && gtk_widget_is_drawable (header))
     {
-      gtk_widget_get_outer_allocation (header, &allocation);
-      y = allocation.y;
-      height += allocation.height;
+      gtk_widget_compute_bounds (header, GTK_WIDGET (box), &rect);
+      y = rect.origin.y;
+      height += rect.size.height;
     }
 
   gtk_adjustment_clamp_page (priv->adjustment, y, y + height);
index 56b502f8d12433ba26d51fdb95910ba4b6b5d466..3e58d7e15275ed6f8a97f66c2b099cdc7c5051d8 100644 (file)
@@ -3056,16 +3056,17 @@ check_threshold (GtkWidget *widget,
 }
 
 static gboolean
-definitely_within_item (GtkWidget *widget,
+definitely_within_item (GtkMenu   *menu,
+                        GtkWidget *widget,
                         gint       x,
                         gint       y)
 {
-  GtkAllocation allocation;
   int w, h;
+  graphene_rect_t bounds;
 
-  gtk_widget_get_outer_allocation (widget, &allocation);
-  w = allocation.width;
-  h = allocation.height;
+  gtk_widget_compute_bounds (widget, GTK_WIDGET (menu), &bounds);
+  w = bounds.size.width;
+  h = bounds.size.height;
 
   return
     check_threshold (widget, 0, 0, x, y) &&
@@ -3128,7 +3129,7 @@ gtk_menu_motion (GtkEventController *controller,
   menu_shell = GTK_MENU_SHELL (parent);
   menu = GTK_MENU (menu_shell);
 
-  if (definitely_within_item (menu_item, event->x, event->y))
+  if (definitely_within_item (menu, menu_item, event->x, event->y))
     menu_shell->priv->activate_time = 0;
 
   /* Check to see if we are within an active submenu's navigation region
index 03407ac810de14256d13506edfca7070a6300f1b..a168b115d6935a7380d563e4a987648cc8b5012c 100644 (file)
@@ -2292,7 +2292,6 @@ gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
 
   if ((tab = get_tab_at_pos (notebook, x, y)) != NULL)
     {
-      GtkAllocation allocation;
       gboolean page_changed, was_focus;
 
       page = tab->data;
@@ -2308,6 +2307,8 @@ gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
       /* save press to possibly begin a drag */
       if (page->reorderable || page->detachable)
         {
+          graphene_rect_t tab_bounds;
+
           priv->pressed_button = button;
 
           priv->mouse_x = x;
@@ -2316,10 +2317,10 @@ gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
           priv->drag_begin_x = priv->mouse_x;
           priv->drag_begin_y = priv->mouse_y;
 
-          gtk_widget_get_outer_allocation (page->tab_widget, &allocation);
+          gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds);
 
-          priv->drag_offset_x = priv->drag_begin_x - allocation.x;
-          priv->drag_offset_y = priv->drag_begin_y - allocation.y;
+          priv->drag_offset_x = priv->drag_begin_x - tab_bounds.origin.x;
+          priv->drag_offset_y = priv->drag_begin_y - tab_bounds.origin.y;
         }
     }
 }
@@ -2416,9 +2417,9 @@ get_drop_position (GtkNotebook *notebook)
           page->tab_label &&
           gtk_widget_get_mapped (page->tab_label))
         {
-          GtkAllocation allocation;
+          graphene_rect_t tab_bounds;
 
-          gtk_widget_get_outer_allocation (page->tab_widget, &allocation);
+          gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds);
 
           switch (priv->tab_pos)
             {
@@ -2426,19 +2427,19 @@ get_drop_position (GtkNotebook *notebook)
             case GTK_POS_BOTTOM:
               if (!is_rtl)
                 {
-                  if (allocation.x + allocation.width / 2 > x)
+                  if (tab_bounds.origin.x + tab_bounds.size.width / 2 > x)
                     return children;
                 }
               else
                 {
-                  if (allocation.x + allocation.width / 2 < x)
+                  if (tab_bounds.origin.x + tab_bounds.size.width / 2 < x)
                     return children;
                 }
               break;
 
             case GTK_POS_LEFT:
             case GTK_POS_RIGHT:
-              if (allocation.y + allocation.height / 2 > y)
+              if (tab_bounds.origin.y + tab_bounds.size.height / 2 > y)
                 return children;
               break;
 
index 369468c0a6889875216596848bc1d702def3597c..97ea15593b2191ff5c71c968ac91fb205943af0c 100644 (file)
@@ -292,21 +292,18 @@ add_move_binding (GtkBindingSet   *binding_set,
 }
 
 static void
-get_handle_area (GtkPaned     *paned,
-                 GdkRectangle *area)
+get_handle_area (GtkPaned        *paned,
+                 graphene_rect_t *area)
 {
   GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
   int extra = 0;
 
-  gtk_widget_get_outer_allocation (priv->handle_widget, area);
+  gtk_widget_compute_bounds (priv->handle_widget, GTK_WIDGET (paned), area);
 
   if (!gtk_paned_get_wide_handle (paned))
     extra = HANDLE_EXTRA_SIZE;
 
-  area->x -= extra;
-  area->y -= extra;
-  area->width += extra * 2;
-  area->height += extra * 2;
+  graphene_rect_inset (area, - extra, - extra);
 }
 
 static void
@@ -316,11 +313,12 @@ gtk_paned_motion (GtkEventControllerMotion *motion,
                   GtkPaned                 *paned)
 {
   GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
-  GdkRectangle handle_area;
+  graphene_rect_t handle_area;
 
   get_handle_area (paned, &handle_area);
 
-  if (gdk_rectangle_contains_point (&handle_area, x, y) || priv->panning)
+  if (graphene_rect_contains_point (&handle_area, &(graphene_point_t){x, y}) ||
+      priv->panning)
     {
       if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
         gtk_widget_set_cursor_from_name (GTK_WIDGET (paned), "col-resize");
@@ -748,7 +746,7 @@ gesture_drag_begin_cb (GtkGestureDrag *gesture,
 {
   GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
   GdkEventSequence *sequence;
-  GdkRectangle handle_area;
+  graphene_rect_t handle_area;
   const GdkEvent *event;
   GdkDevice *device;
   gboolean is_touch;
@@ -771,7 +769,7 @@ gesture_drag_begin_cb (GtkGestureDrag *gesture,
       return;
     }
 
-  if (gdk_rectangle_contains_point (&handle_area, (int)start_x, (int)start_y) ||
+  if (graphene_rect_contains_point (&handle_area, &(graphene_point_t){start_x, start_y}) ||
       (is_touch && initiates_touch_drag (paned, start_x, start_y)))
     {
       if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -1401,7 +1399,6 @@ gtk_paned_snapshot (GtkWidget   *widget,
                     GtkSnapshot *snapshot)
 {
   GtkPanedPrivate *priv = gtk_paned_get_instance_private (GTK_PANED (widget));
-  GtkAllocation child_allocation;
 
   gtk_snapshot_push_clip (snapshot,
                           &GRAPHENE_RECT_INIT (
@@ -1416,34 +1413,10 @@ gtk_paned_snapshot (GtkWidget   *widget,
     gtk_widget_snapshot_child (widget, priv->handle_widget, snapshot);
 
   if (priv->child1 && gtk_widget_get_visible (priv->child1))
-    {
-      gtk_widget_get_outer_allocation (priv->child1, &child_allocation);
-      gtk_snapshot_push_clip (snapshot,
-                              &GRAPHENE_RECT_INIT (
-                                  child_allocation.x,
-                                  child_allocation.y,
-                                  child_allocation.width,
-                                  child_allocation.height
-                              ),
-                              "GtkPanedChild1");
-      gtk_widget_snapshot_child (widget, priv->child1, snapshot);
-      gtk_snapshot_pop (snapshot);
-    }
+    gtk_widget_snapshot_child (widget, priv->child1, snapshot);
 
   if (priv->child2 && gtk_widget_get_visible (priv->child2))
-    {
-      gtk_widget_get_outer_allocation (priv->child2, &child_allocation);
-      gtk_snapshot_push_clip (snapshot,
-                              &GRAPHENE_RECT_INIT (
-                                  child_allocation.x,
-                                  child_allocation.y,
-                                  child_allocation.width,
-                                  child_allocation.height
-                              ),
-                              "GtkPanedChild2");
-      gtk_widget_snapshot_child (widget, priv->child2, snapshot);
-      gtk_snapshot_pop (snapshot);
-    }
+    gtk_widget_snapshot_child (widget, priv->child2, snapshot);
 
   gtk_snapshot_pop (snapshot);
 }
index 3c54dee7246ab276cf39346c41b92c6d04151e28..67b94f7da2560604e80be76810a17d7337b53d10 100644 (file)
@@ -40,7 +40,6 @@
 #include "gtkprivate.h"
 #include "gtkscale.h"
 #include "gtktypebuiltins.h"
-#include "gtkwidgetprivate.h"
 #include "gtkwindow.h"
 #include "gtkeventcontrollerkey.h"
 
@@ -901,11 +900,19 @@ gtk_range_get_range_rect (GtkRange     *range,
                           GdkRectangle *range_rect)
 {
   GtkRangePrivate *priv = gtk_range_get_instance_private (range);
+  graphene_rect_t r;
 
   g_return_if_fail (GTK_IS_RANGE (range));
   g_return_if_fail (range_rect != NULL);
 
-  gtk_widget_get_outer_allocation (priv->trough_widget, range_rect);
+  gtk_widget_compute_bounds (priv->trough_widget, GTK_WIDGET (range), &r);
+
+  *range_rect = (GdkRectangle) {
+    floorf (r.origin.x),
+    floorf (r.origin.y),
+    ceilf (r.size.width),
+    ceilf (r.size.height),
+  };
 }
 
 /**
@@ -927,25 +934,25 @@ gtk_range_get_slider_range (GtkRange *range,
                             gint     *slider_end)
 {
   GtkRangePrivate *priv = gtk_range_get_instance_private (range);
-  GtkAllocation slider_alloc;
+  graphene_rect_t slider_bounds;
 
   g_return_if_fail (GTK_IS_RANGE (range));
 
-  gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc);
+  gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds);
 
   if (priv->orientation == GTK_ORIENTATION_VERTICAL)
     {
       if (slider_start)
-        *slider_start = slider_alloc.y;
+        *slider_start = slider_bounds.origin.y;
       if (slider_end)
-        *slider_end = slider_alloc.y + slider_alloc.height;
+        *slider_end = slider_bounds.origin.y + slider_bounds.size.height;
     }
   else
     {
       if (slider_start)
-        *slider_start = slider_alloc.x;
+        *slider_start = slider_bounds.origin.y;
       if (slider_end)
-        *slider_end = slider_alloc.x + slider_alloc.width;
+        *slider_end = slider_bounds.origin.x + slider_bounds.size.width;
     }
 }
 
@@ -1760,19 +1767,19 @@ coord_to_value (GtkRange *range,
   gdouble value;
   gint    trough_length;
   gint    slider_length;
-  GtkAllocation slider_alloc;
+  graphene_rect_t slider_bounds;
 
-  gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc);
+  gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds);
 
   if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       trough_length = gtk_widget_get_width (priv->trough_widget);
-      slider_length = slider_alloc.width;
+      slider_length = slider_bounds.size.width;
     }
   else
     {
       trough_length = gtk_widget_get_height (priv->trough_widget);
-      slider_length = slider_alloc.height;
+      slider_length = slider_bounds.size.height;
     }
 
   if (trough_length == slider_length)
@@ -1819,14 +1826,14 @@ gtk_range_key_controller_key_pressed (GtkEventControllerKey *controller,
            (keyval == GDK_KEY_Shift_L ||
             keyval == GDK_KEY_Shift_R))
     {
-      GtkAllocation slider_alloc;
+      graphene_rect_t slider_bounds;
 
-      gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc);
+      gtk_widget_compute_bounds (priv->slider_widget, priv->trough_widget, &slider_bounds);
 
       if (priv->orientation == GTK_ORIENTATION_VERTICAL)
-        priv->slide_initial_slider_position = slider_alloc.y;
+        priv->slide_initial_slider_position = slider_bounds.origin.y;
       else
-        priv->slide_initial_slider_position = slider_alloc.x;
+        priv->slide_initial_slider_position = slider_bounds.origin.x;
       update_zoom_state (range, !priv->zoom);
 
       return GDK_EVENT_STOP;
@@ -1893,8 +1900,8 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
   gboolean shift_pressed;
   guint button;
   GdkModifierType state_mask;
-  GtkAllocation slider_alloc;
   GtkWidget *mouse_location;
+  graphene_rect_t slider_bounds;
 
   if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
@@ -1908,7 +1915,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
   source_device = gdk_event_get_source_device ((GdkEvent *) event);
   source = gdk_device_get_source (source_device);
 
-  gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc);
+  gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds);
 
   g_object_get (gtk_widget_get_settings (widget),
                 "gtk-primary-button-warps-slider", &primary_warps,
@@ -1956,8 +1963,8 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
       /* If we aren't fixed, center on the slider. I.e. if this is not a scale... */
       if (!priv->slider_size_fixed)
         {
-          slider_range_x += (slider_alloc.width / 2);
-          slider_range_y += (slider_alloc.height / 2);
+          slider_range_x += (slider_bounds.size.width  / 2);
+          slider_range_y += (slider_bounds.size.height / 2);
         }
 
       update_initial_slider_position (range, slider_range_x, slider_range_y);
@@ -2044,12 +2051,12 @@ update_slider_position (GtkRange *range,
 
   if (priv->zoom)
     {
-      GtkAllocation trough_alloc;
+      graphene_rect_t trough_bounds;
 
-      gtk_widget_get_outer_allocation (priv->trough_widget, &trough_alloc);
+      gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds);
 
       zoom = MIN(1.0, (priv->orientation == GTK_ORIENTATION_VERTICAL ?
-                       trough_alloc.height : trough_alloc.width) /
+                       trough_bounds.size.height : trough_bounds.size.width) /
                        (gtk_adjustment_get_upper (priv->adjustment) -
                         gtk_adjustment_get_lower (priv->adjustment) -
                         gtk_adjustment_get_page_size (priv->adjustment)));
@@ -2063,14 +2070,14 @@ update_slider_position (GtkRange *range,
   /* recalculate the initial position from the current position */
   if (priv->slide_initial_slider_position == -1)
     {
-      GtkAllocation slider_alloc;
+      graphene_rect_t slider_bounds;
 
-      gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc);
+      gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds);
 
       if (priv->orientation == GTK_ORIENTATION_VERTICAL)
-        priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_alloc.y) / (zoom - 1.0);
+        priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / (zoom - 1.0);
       else
-        priv->slide_initial_slider_position = (zoom * (mouse_x - priv->slide_initial_coordinate_delta) - slider_alloc.x) / (zoom - 1.0);
+        priv->slide_initial_slider_position = (zoom * (mouse_x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / (zoom - 1.0);
     }
 
   if (priv->orientation == GTK_ORIENTATION_VERTICAL)
index cea8b3ef6d469255fbf0a055e44bff3ac37e2139..96554cedac6489c3269f3ae73a1fa9be841b8025 100644 (file)
@@ -42,7 +42,6 @@
 #include "gtkstylecontextprivate.h"
 #include "gtkstylepropertyprivate.h"
 #include "gtktypebuiltins.h"
-#include "gtkwidgetprivate.h"
 
 #include "a11y/gtkscaleaccessible.h"
 
@@ -329,14 +328,15 @@ gtk_scale_allocate_value (GtkScale *scale)
   GtkWidget *widget = GTK_WIDGET (scale);
   GtkRange *range = GTK_RANGE (widget);
   GtkWidget *slider_widget;
-  GtkAllocation slider_alloc, value_alloc;
+  GtkAllocation value_alloc;
   int range_width, range_height;
+  graphene_rect_t slider_bounds;
 
   range_width = gtk_widget_get_width (widget);
   range_height = gtk_widget_get_height (widget);
 
   slider_widget = gtk_range_get_slider_widget (range);
-  gtk_widget_get_outer_allocation (slider_widget, &slider_alloc);
+  gtk_widget_compute_bounds (slider_widget, widget, &slider_bounds);
 
   gtk_widget_measure (priv->value_widget,
                       GTK_ORIENTATION_HORIZONTAL, -1,
@@ -362,12 +362,12 @@ gtk_scale_allocate_value (GtkScale *scale)
           break;
 
         case GTK_POS_TOP:
-          value_alloc.x = slider_alloc.x + (slider_alloc.width - value_alloc.width) / 2;
+          value_alloc.x = slider_bounds.origin.x + (slider_bounds.size.width - value_alloc.width) / 2;
           value_alloc.y = 0;
           break;
 
         case GTK_POS_BOTTOM:
-          value_alloc.x = slider_alloc.x + (slider_alloc.width - value_alloc.width) / 2;
+          value_alloc.x = slider_bounds.origin.x + (slider_bounds.size.width - value_alloc.width) / 2;
           value_alloc.y = range_height - value_alloc.height;
           break;
 
@@ -382,12 +382,12 @@ gtk_scale_allocate_value (GtkScale *scale)
         {
         case GTK_POS_LEFT:
           value_alloc.x = 0;
-          value_alloc.y = (slider_alloc.y + (slider_alloc.height / 2)) - value_alloc.height / 2;
+          value_alloc.y = (slider_bounds.origin.y + (slider_bounds.size.height / 2)) - value_alloc.height / 2;
           break;
 
         case GTK_POS_RIGHT:
           value_alloc.x = range_width - value_alloc.width;
-          value_alloc.y = (slider_alloc.y + (slider_alloc.height / 2)) - value_alloc.height / 2;
+          value_alloc.y = (slider_bounds.origin.y + (slider_bounds.size.height / 2)) - value_alloc.height / 2;
           break;
 
         case GTK_POS_TOP:
@@ -1514,7 +1514,7 @@ gtk_scale_real_get_layout_offsets (GtkScale *scale,
                                    gint     *y)
 {
   GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
-  GtkAllocation value_alloc;
+  graphene_rect_t value_bounds;
 
   if (!priv->value_widget)
     {
@@ -1524,10 +1524,10 @@ gtk_scale_real_get_layout_offsets (GtkScale *scale,
       return;
     }
 
-  gtk_widget_get_outer_allocation (priv->value_widget, &value_alloc);
+  gtk_widget_compute_bounds (priv->value_widget, GTK_WIDGET (scale), &value_bounds);
 
-  *x = value_alloc.x;
-  *y = value_alloc.y;
+  *x = value_bounds.origin.x;
+  *y = value_bounds.origin.y;
 }
 
 static gchar *
index 761a09c3c673b87b470731d5953bf3377ffe9067..9da2d1ea82e3d91b9deae6ef4f35c3f3fd322067 100644 (file)
@@ -1063,13 +1063,13 @@ event_close_to_indicator (GtkScrolledWindow *sw,
                           GdkEvent          *event)
 {
   GtkScrolledWindowPrivate *priv;
-  GtkAllocation indicator_alloc;
+  graphene_rect_t indicator_bounds;
   gdouble x, y;
   gint distance;
 
   priv = sw->priv;
 
-  gtk_widget_get_outer_allocation (indicator->scrollbar, &indicator_alloc);
+  gtk_widget_compute_bounds (indicator->scrollbar, GTK_WIDGET (sw), &indicator_bounds);
   gdk_event_get_coords (event, &x, &y);
 
   if (indicator->over)
@@ -1077,16 +1077,18 @@ event_close_to_indicator (GtkScrolledWindow *sw,
   else
     distance = INDICATOR_CLOSE_DISTANCE;
 
+  graphene_rect_inset (&indicator_bounds, distance, distance);
+
   if (indicator == &priv->hindicator)
     {
-       if (y >= indicator_alloc.y - distance &&
-           y < indicator_alloc.y + indicator_alloc.height + distance)
+      if (y >= indicator_bounds.origin.y &&
+          y < indicator_bounds.origin.y + indicator_bounds.size.height)
          return TRUE;
     }
   else if (indicator == &priv->vindicator)
     {
-      if (x >= indicator_alloc.x - distance &&
-          x < indicator_alloc.x + indicator_alloc.width + distance)
+      if (x >= indicator_bounds.origin.x &&
+          x < indicator_bounds.origin.x + indicator_bounds.size.width)
         return TRUE;
     }
 
index cd5af76fcef1520c0aff79ff42500ea83cf2fe69..c6acab5da7338939e57fd19eb308314dae907613 100644 (file)
@@ -29,7 +29,6 @@
 #include "gtkorientableprivate.h"
 #include "gtkintl.h"
 #include "gtkprivate.h"
-#include "gtkwidgetprivate.h"
 
 /**
  * SECTION:gtkseparator
index 000e87bf9c226fd0ec182b256302486028aec67c..62435ad831a6864dcf4900cd7129f8614ed4df0f 100644 (file)
@@ -310,10 +310,7 @@ gtk_stack_switcher_drag_motion (GtkWidget      *widget,
   g_hash_table_iter_init (&iter, priv->buttons);
   while (g_hash_table_iter_next (&iter, NULL, &value))
     {
-      GdkRectangle allocation;
-
-      gtk_widget_get_outer_allocation (GTK_WIDGET (value), &allocation);
-      if (gdk_rectangle_contains_point (&allocation, (int)x, (int)y))
+      if (gtk_widget_contains (GTK_WIDGET (value), x, y))
         {
           button = GTK_WIDGET (value);
           retval = TRUE;
index fb3b21f7326db0425069c0a03348d854a49ec6c0..2116eafcf20a6ca2c39853c0455eb3aebae3478b 100644 (file)
@@ -188,16 +188,16 @@ gtk_switch_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
                                        GtkSwitch            *sw)
 {
   GtkSwitchPrivate *priv = gtk_switch_get_instance_private (sw);
-  GtkAllocation allocation;
+  graphene_rect_t switch_bounds;
 
-  gtk_widget_get_outer_allocation (GTK_WIDGET (sw), &allocation);
+  gtk_widget_compute_bounds (GTK_WIDGET (sw), GTK_WIDGET (sw), &switch_bounds);
   gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
 
   /* If the press didn't happen in the draggable handle,
    * cancel the pan gesture right away
    */
-  if ((priv->is_active && x <= allocation.width / 2.0) ||
-      (!priv->is_active && x > allocation.width / 2.0))
+  if ((priv->is_active && x <= switch_bounds.size.width / 2.0) ||
+      (!priv->is_active && x > switch_bounds.size.width / 2.0))
     gtk_gesture_set_state (priv->pan_gesture, GTK_EVENT_SEQUENCE_DENIED);
 }
 
index defb47a51d4b4acb2121b6ca3c93e55cda5eaf79..af4531ebda80cc68aebb51bdd97eac03d7220c2e 100644 (file)
@@ -3059,7 +3059,7 @@ _gtk_tree_view_column_coords_in_resize_rect (GtkTreeViewColumn *column,
                                              double             y)
 {
   GtkTreeViewColumnPrivate *priv = column->priv;
-  GtkAllocation button_allocation;
+  graphene_rect_t button_bounds;
 
   /* x and y are in treeview coordinates. */
 
@@ -3068,14 +3068,13 @@ _gtk_tree_view_column_coords_in_resize_rect (GtkTreeViewColumn *column,
       !priv->visible)
     return FALSE;
 
-  gtk_widget_get_outer_allocation (priv->button, &button_allocation);
-
-  /* No translation needed */
-  g_assert (gtk_widget_get_parent (priv->button) == priv->tree_view);
+  gtk_widget_compute_bounds (priv->button, priv->tree_view, &button_bounds);
 
   if (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_LTR)
-    button_allocation.x += button_allocation.width - TREE_VIEW_DRAG_WIDTH;
+    button_bounds.origin.x += button_bounds.size.width - TREE_VIEW_DRAG_WIDTH;
+
+  button_bounds.size.width = TREE_VIEW_DRAG_WIDTH;
 
-  button_allocation.width = TREE_VIEW_DRAG_WIDTH;
-  return gdk_rectangle_contains_point (&button_allocation, (int)x, (int)y);
+  return graphene_rect_contains_point (&button_bounds,
+                                       &(graphene_point_t){x, y});
 }
index d9ed6d06e7874ac73e3ec6cc0894057a342ce7cb..0ed3d85c13fefbeb9caecf06614e068591f53eb1 100644 (file)
@@ -11445,25 +11445,6 @@ gtk_widget_pick (GtkWidget *widget,
   return GTK_WIDGET_GET_CLASS (widget)->pick (widget, x, y);
 }
 
-void
-gtk_widget_get_outer_allocation (GtkWidget    *widget,
-                                 GdkRectangle *allocation)
-{
-  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
-  GtkBorder margin;
-  GtkCssStyle *style;
-
-  style = gtk_css_node_get_style (priv->cssnode);
-  get_box_margin (style, &margin);
-
-  *allocation = priv->allocation;
-
-  allocation->x += margin.left;
-  allocation->y += margin.top;
-  allocation->width -= margin.left + margin.right;
-  allocation->height -= margin.top + margin.bottom;
-}
-
 /**
  * gtk_widget_compute_bounds:
  * @widget: the #GtkWidget to query
index a6be3a51d10814e2415953eba7186b0878db26a5..9a1d918444691db96c6dda176b6b87a1b63bc6ec 100644 (file)
@@ -319,8 +319,6 @@ void              gtk_widget_focus_sort                    (GtkWidget        *wi
 gboolean          gtk_widget_focus_move                    (GtkWidget        *widget,
                                                             GtkDirectionType  direction,
                                                             GPtrArray        *focus_order);
-void              gtk_widget_get_outer_allocation          (GtkWidget        *widget,
-                                                            GtkAllocation    *allocation);
 void              gtk_widget_get_surface_allocation         (GtkWidget *widget,
                                                             GtkAllocation *allocation);